package salary.calculation.common.response;

import salary.calculation.common.enumerate.IResponseEnum;

public class DataResponse<T> extends BaseResponse {
    private T data;

    public DataResponse(T data) {
        super();
        this.data = data;
    }

    public DataResponse(int code, String msg) {
        super(code, msg);
    }

    public DataResponse(IResponseEnum responseEnum) {
        super(responseEnum);
    }

    public DataResponse(int code, String msg, T data) {
        super(code, msg);
        this.data = data;
    }

    public DataResponse(IResponseEnum responseEnum, T data) {
        super(responseEnum);
        this.data = data;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public static DataResponse newInstance(Object data) {
        return new DataResponse(data);
    }

    public static DataResponse newInstance(IResponseEnum responseEnum) {
        return new DataResponse(responseEnum);
    }

    @Override
    public String toString() {
        return "DataResponse{" +
                "data=" + data +
                "} " + super.toString();
    }
}
